package lastfm
{
  import asunit.framework.TestCase;
  import lastfm.events.ArtistInfoEvent;

  /**
   * ...
   * @author Roman Marchenko
   */
  public class TestArtistInfo extends TestCase
  {

    public function TestArtistInfo(testMethod:String = null)
    {
      super(testMethod);

    }

    public function testArtistInfo():void
    {
      var handler:Function = function(event:ArtistInfoEvent):void
      {
        assertEquals("Cher", event.artist);
        assertEquals("http://www.last.fm/music/Cher", event.url);

        assertNotNull(event.image["small"]);
        assertNotNull(event.image["medium"]);
        assertNotNull(event.image["large"]);

        assertNotNull(event.stats);
        assertTrue(event.stats.listeners > 0);
        assertTrue(event.stats.playcount > 0);

        assertNotNull(event.bio);

        assertNotNull(event.similar);
        assertTrue(event.similar is Array);
        assertTrue(0 < event.similar.length);
        assertEquals("Sonny & Cher", event.similar[0]);
      }

      var obj:ArtistInfo = new ArtistInfo;
      obj.addEventListener(ArtistInfoEvent.OK, addAsync(handler, 10000));
      obj.loadInfo("Cher");
    }
  }

}